﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Method
{
    public static class StringBuilderExtensions
    {
        public static int IndexOf(this StringBuilder sb, char value)
        {
            for (int index = 0; index < sb.Length; index++)
                if (sb[index] == value) return index;
            return -1;
        }

        public static void ShowItems<T>(this IEnumerable<T> collection)
        {
            foreach (var item in collection) Console.WriteLine(item);
        }

        public static void InvokeAndCatch<TExcepion>(this Action<Object> b, Object o) where TExcepion : Exception
        {
            try
            {
                b(o);
            }
            catch (TExcepion)
            {
            }
        }
    }
}
